import numpy as np
from scipy.linalg import svd 
from numpy import ndarray

class SVD:

    svd = svd
    @staticmethod
    def reconstruct(U, s, Vh):
        # 获取矩阵的维度
        m, n = U.shape[0], Vh.shape[1]
        # 构建sigma
        sigma = np.zeros((m, n))
        for i in range(min(m, n)):
            sigma[i, i] = s[i]
        # 利用sigma 重构 A
        a = np.dot(U, np.dot(sigma, Vh))

        return a            
